home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d21 / dvintqb.arc / DVINTQB.ASM next >
Assembly Source File  |  1990-08-12  |  3KB  |  135 lines

  1.     NAME    DVINT
  2.     TITLE    DESQview Interfaces
  3.     PAGE    66,132
  4.  
  5. DVINT_SEG SEGMENT 'CODE'
  6.     ASSUME    CS:DVINT_SEG
  7.  
  8.     PUBLIC  DVGETVER
  9.     PUBLIC  DVPAUSE
  10.     PUBLIC  DVLOCK
  11.     PUBLIC  DVNORMAL
  12.     PUBLIC  DVGETVID
  13.  
  14. IN_DV    DB 1
  15.  
  16. GET_VERSION PROC
  17.     PUSH    BX
  18.     PUSH    CX
  19.     PUSH    DX
  20.     MOV    AX,2B01H        ; DV get version request
  21.     MOV    CX,'DE'
  22.     MOV    DX,'SQ'
  23.     INT    21H
  24.     CMP    AL,0FFH            ; Are we in DV?
  25.     JE    NO_DV            ; Jump if not
  26.     MOV    AX,BX            ; We are; put the version number in AX
  27.     MOV    CS:IN_DV,1        ; Set the local IN_DV flag
  28.     JMP    SHORT DVGV_EXIT
  29. NO_DV:    SUB    AX,AX            ; Clear AX
  30.     MOV    CS:IN_DV,AL        ; And the local flag
  31. DVGV_EXIT:
  32.     POP    DX
  33.     POP    CX
  34.     POP    BX
  35.     RET
  36. GET_VERSION ENDP
  37.  
  38. ; DVGETVER returns the DV version number in AX, or 0 if not in
  39. ; DV.  This should be called before any other DV functions
  40. DVGETVER PROC FAR
  41.     CALL    GET_VERSION
  42.     RET
  43. DVGETVER ENDP
  44.  
  45. ; API_CALL is a local routine that goes on stack, does whatever call is
  46. ; passed it in BX, and then goes off stack
  47. API_CALL PROC
  48.     PUSH    AX
  49.     MOV    AX,101AH
  50.     INT    15H            ; OSTACK
  51.     MOV    AX,BX
  52.     INT    15H            ; Parameter
  53.     MOV    AX,1025H
  54.     INT    15H            ; USTACK
  55.     POP    AX
  56.     RET
  57. API_CALL ENDP
  58.  
  59. ; DVPAUSE gives up the rest of its time slice when called
  60. DVPAUSE PROC FAR
  61.     CMP    CS:IN_DV,1        ; Are we in DV?
  62.     JNE    DVP_END            ; Jump if not
  63.     PUSH    BX
  64.     MOV    BX,1000H        ; PAUSE function call
  65.     CALL    API_CALL
  66.     POP    BX
  67. DVP_END:
  68.     RET
  69. DVPAUSE ENDP
  70.  
  71. ; Begins a critical region.  This is a section of code which DV will not
  72. ; slice out of.  It MUST be ended with a DVNORMAL call.
  73. DVLOCK PROC FAR
  74.     CMP    CS:IN_DV,1        ; Are we in DV?
  75.     JNE    DVBC_END        ; Jump if not
  76.     PUSH    BX
  77.     MOV    BX,101BH        ; BEGINC
  78.     CALL    API_CALL
  79.     POP    BX
  80. DVBC_END:
  81.     RET
  82. DVLOCK ENDP
  83.  
  84. ; Ends a critical region.
  85. DVNORMAL PROC FAR
  86.     CMP    CS:IN_DV,1        ; Are we in DV?
  87.     JNE    DVEC_END        ; Jump if not
  88.     PUSH    BX
  89.     MOV    BX,101CH        ; ENDC
  90.     CALL    API_CALL
  91.     POP    BX
  92. DVEC_END:
  93.     RET
  94. DVNORMAL ENDP
  95.  
  96. ; Passed on the stack the video buffer address to use outside of DV.
  97. ; Returns the video buffer address to use instead.
  98. ; If what it returns is different, then video synching is not necessary.
  99. ; Also, this call does a DVGETVER call itself, so if you get
  100. ; the video buffer, it is not required that you get the version.
  101. DVGETVID PROC FAR
  102.     PUSH    BP
  103.     MOV    BP,SP
  104.     PUSH    BX
  105.     PUSH    DI
  106.     PUSH    ES
  107.     MOV    ES,[BP+6]        ; Put the starting segment in ES
  108.     CALL    GET_VERSION
  109.     TEST    AX,AX            ; Are we in DESQview?
  110.     JZ    DVGVB_END        ; Jump if not
  111.     SUB    DI,DI            ; Clear DI
  112.     MOV    AH,0FEH            ; Get video buffer function call
  113.     INT    10H
  114. DVGVB_END:
  115.     MOV    AX,ES
  116.     POP    ES
  117.     POP    DI
  118.     POP    BX
  119.     POP    BP
  120.     RET    2
  121. DVGETVID ENDP
  122.  
  123. DVINT_SEG ENDS
  124.  
  125.     END
  126. on call
  127.     INT    10H
  128. DVGVB_END:
  129.     MOV    AX,ES
  130.     POP    ES
  131.     POP    DI
  132.     POP    BX
  133.     POP    BP
  134.     RET    2
  135. D